# -*- coding: utf-8 -*-
#!/usr/bin/python
import MySQLdb
import MySQLdb.cursors
# Open database connection
db = MySQLdb.connect(host="localhost", user="root", passwd="ayaxyz1425gg", db="rubyaura", cursorclass=MySQLdb.cursors.DictCursor)
#r = 1
#sql = """SELECT * FROM tbl_members WHERE pk_uid=%d;"""%(r) 
#print sql

sql = """SELECT * FROM tbl_members;""" 
db.query("set character_set_connection=utf8;")
db.query("set character_set_server=utf8;")
db.query("set character_set_client=utf8;")
db.query("set character_set_results=utf8;")
db.query("set character_set_database=utf8;")
cur = db.cursor()
cur.execute(sql)
rs = cur.fetchall()
#print type(rs)
#print type(rs[1])

for row in rs : 
	print row
	for k,v in row.items():
		print("[key]>>"+str(k)+" [val]>>"+str(v))

#rrs = dict(map(reversed,rs))
#print rrs
cur.close()